package stark.app;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.listener.OnItemClickListener;

import stark.app.databinding.FragmentFrameBinding;
import stark.app.frame.TextItemAdapter;
import stark.common.basic.base.BaseNoModelFragment;

/**
 * create by fanlc
 * on 2020/10/21
 * description
 */
public abstract class MainBaseFragment extends BaseNoModelFragment<FragmentFrameBinding> implements OnItemClickListener {

    protected TextItemAdapter mAdapter;

    @Override
    protected int onCreate() {
        return R.layout.fragment_frame;
    }

    @Override
    protected void initView() {
        mAdapter = new TextItemAdapter();
        RecyclerView rv = mDataBinding.frameRv;
        rv.setLayoutManager(new LinearLayoutManager(mContext));
        rv.setAdapter(mAdapter);
        mAdapter.setOnItemClickListener(this);
    }

    @Override
    protected void initData() {
        mDataBinding.setLifecycleOwner(this);
        addDefaultData();
    }

    public abstract void addDefaultData();
}
